﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BlueRadar.API;

namespace BlueRadar.UI
{
    /// <summary>
    /// Interaction logic for CurrentDeviceStatus.xaml
    /// </summary>
    public partial class DeviceInformation : Window
    {
        private BlueSupport support;

        public DeviceInformation()
        {
            InitializeComponent();

            support = new BlueSupport();
            this.DataContext = support;

            IsBluetoothSupported();
        }

        bool IsBluetoothSupported()
        {
            if (support.IsBluetoothSupported)
            {
                //if (!support.IsDiscoverable)
                //{
                //    if (MessageBox.Show("Make BluetoothRadio Discoverable?", "Bluetooth Radar", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                //    {
                //        support.MakeDiscoverable();
                //    }
                //}
                return true;
            }
            else
            {
                MessageBox.Show("No support Bluetooth radio/stack found.\n\nBluetooth Radar requires active Bluetooth device", "Bluetooth Radar", MessageBoxButton.OK, MessageBoxImage.Information);
                return false;
            }
        }

        private void btn_close_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.Close();
        }

        private void btn_save_MouseDown(object sender, MouseButtonEventArgs e)
        {
            support.ChangeDeviceMode(combo_mode.SelectionBoxItem.ToString());
            this.Close();
        }

        private void rectangle1_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
                this.DragMove();
        }
    }
}
